import path from "node:path";
import url from "node:url";

/**
 * @power ms-vscode.ts-file-path-support
 * @template TBaseDir
 * @typedef {string & { baseDir?: TBaseDir }} RelativeFilePath
 */
// /**
//  * @template Out
//  * @template {Out} In
//  * @typedef {In & { [Key in Exclude<keyof In, keyof Out>]: never }} SameShape
//  */

/**
 * @param {RelativeFilePath<'$dir'>} p
 * @returns {string & {__path__?: symbol}}
 */
export const pwd2 = (p) =>
  path.resolve(path.dirname(url.fileURLToPath(import.meta.url)), p);
